package com.jcb.countfrench.presenter;


import android.content.Context;
import android.util.Log;
import android.view.View;

import com.jcb.countfrench.MainActivity;
import com.jcb.countfrench.R;
import com.jcb.countfrench.dao.CountFrenchDAO;
import com.jcb.countfrench.dao.GlobalDAO;
import com.jcb.countfrench.model.BasicData;
import com.jcb.countfrench.model.User;

public class CountPresenter {
	private User user ;
	private CountFrenchDAO countFrenchDAO ;
	Context context ;
	MainActivity mainActivity ;

	
	 public CountPresenter(User user, CountFrenchDAO countFrenchDAO, Context context, MainActivity mainActivity) {
		super();
		this.user = user;
		this.countFrenchDAO = countFrenchDAO;
		this.context = context;
		this.mainActivity = mainActivity ;
	}

		public void switchView(View v) {
			mainActivity.setContentView(v);
		}
		

		public void setLearningView() {
			mainActivity.setContentView(mainActivity.getLearnView());
		}
		
	public BasicData lastItem(String idGroupe) {
			Log.d("TAG", "firstItem=" );
			BasicData first = countFrenchDAO.getLastWordDictionary(null,idGroupe);
			return first;
	}		
		
		
	public BasicData firstItem(String idGroupe) {
		Log.d("TAG", "firstItem=" );
		BasicData first = countFrenchDAO.getFirstWordDictionary(null,idGroupe);
		return first;
	}
	
	public BasicData prevItem(BasicData basicData) {
		Log.d("TAG", "nextItem=" + basicData.getLibLangRef());
		BasicData next = countFrenchDAO.getPrevWordDictionary(basicData);
		return next;
	}


	public BasicData nextItem(BasicData basicData) {		
		Log.d("TAG", "nextItem=" + basicData.getLibLangRef());
		BasicData next = countFrenchDAO.getNextWordDictionary(basicData);
		return next;
	}


	public BasicData repeat() {
		// TODO Auto-generated method stub
		return null;
	}

	
	
}
